function sql(sql) {
    return new Promise((resolve, reject) => {
        let mysql= require('mysql');
        let connection = mysql.createConnection({
            host     : 'db.chenshengkai.top',
            user     : 'db_leduo',
            password : 'chenshengkai1.0',
            database : 'db_leduo'
        });
        try {
            connection.connect();
        } catch(error) {
            return reject(error)
        }

        connection.query(sql, function (error, results, fields) {
            if (error) {
                connection.end();
                return reject(error)
            }
            connection.end();
            return resolve(results)
        });
    })
}

module.exports = sql